package com.py.message.config;

import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MessageConfig {

     @Bean
    public DirectExchange direct(){
        return new DirectExchange("Wmsdirect",true,true);
    }

    @Bean("check")
    public Queue check(){
        return new Queue("check",true,false,true);
    }


    @Bean("kucun")
    public Queue kucun(){
        return new Queue("kucun",true,false,true);
    }

    @Bean("mesShe")
    public Queue mesShe(){
        return new Queue("mesShe",true,false,true);
    }

    @Bean
    public Binding bindcheck(DirectExchange direct, @Qualifier("check") Queue check){
        return BindingBuilder.bind(check).to(direct).with("check");
    }

    @Bean
    public Binding bindkucun(DirectExchange direct, @Qualifier("kucun") Queue kucun){
        return BindingBuilder.bind(kucun).to(direct).with("kucun");
    }

    @Bean
    public Binding bindmesShe(DirectExchange direct, @Qualifier("mesShe") Queue mesShe){
        return BindingBuilder.bind(mesShe).to(direct).with("mesShe");
    }

}
